<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Admin.Master" Inherits="System.Web.Mvc.ViewPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Administer Users
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="subheader">
        <h2>Registered Users</h2>        
    </div>
    <div>
        <table id="list" class="scroll" cellpadding="0" cellspacing="0"></table>
        <div id="pager" class="scroll" style="text-align:center;"></div>
        <script type="text/javascript">
           function deleteRow()
           {
               $("#list").delRowData(1);
           }
        
            jQuery(document).ready(function() {
                jQuery("#list").jqGrid({
                    url: '<%= Url.Action(MVC.AdministerUsers.GridData()) %>',
                    datatype: 'json',
                    mtype: 'POST',
                    colNames: [ 'Actions', 'Username', 'Email', 'Is Administrator' ],
                    colModel: [
                        { name: 'Actions', index: 'Actions', width: 75, sortable: false },
                        { name: 'Username', index:'Username' },
                        { name: 'Email', index:'Email'},
                        { name: 'IsAdministrator', index:'IsAdministrator' }
                        ],
                  loadComplete: function(){
		                var ids = jQuery("#list").getDataIDs();
		                for(var i=0;i<ids.length;i++){
			                var cl = ids[i];
			                var be = '<a href="<%= Url.Action(MVC.AdministerUsers.Edit()) %>/' + cl + '">Edit</a>'; 
			                var success = jQuery("#list").setRowData(ids[i],{Actions:be});
		                }	
	                },
                  editurl: "GridSave",
                  autowidth: true,
                    //width:640
                    height: 300,
                    pager: jQuery('#pager'),
                    rowNum: 15,
                    rowList: [5, 10, 20, 50],
                    sortname: 'Id',
                    sortorder: "desc",
                    viewrecords: true,
                    imgpath: '../../Content/Themes/Cupertino/Images',
                    //caption: 'My first grid'
                }).navGrid(pager, { edit: false, add: false, del: true, search: false }, {}, {}, {url: "<%= Url.Action(MVC.AdministerUsers.Delete()) %>"});
            }); 
        </script>
    </div>
</asp:Content>

